﻿#ifndef TFRAMEWORK_H
#define TFRAMEWORK_H

#include "../../include/itframework.h"

class TFramework : public ITFramework
{
    Q_OBJECT
public:
    static TFramework* GetInstance() {static TFramework __instance; return &__instance;}
public:
    TFramework();
    virtual ~TFramework();
    virtual TRESULT Init();
    virtual TRESULT UnInit();
    virtual TRESULT SetLogger(ITLogger *pLogger);
    virtual TRESULT GetLogger(ITLogger **ppLogger);
    virtual TRESULT GetPublicMgr(ITPublicMgr **ppMgr);
    virtual TRESULT GetUiMgr(ITUiMgr **ppMgr);
    virtual TRESULT GetSalesman(ITService **ppService);
    virtual TRESULT GetSaleswoman(ITService **ppService);
    virtual TRESULT GetUiService(ITService **ppService);
    virtual TRESULT GetCommon(ITCommon **ppCommon);
    virtual TRESULT SetCBDlgStart(pfnCBClient pfn, void *pUserdata);
    virtual TRESULT GetCBDlgStart(pfnCBClient *ppfn, void **ppUserdata);
    virtual TRESULT SetCBCheckIn(pfnCBClient pfn, void *pUserdata);
    virtual TRESULT GetCBCheckIn(pfnCBClient *ppfn, void **ppUserdata);
    virtual TRESULT SetCBConsultant(pfnCBClient pfn, void *pUserdata);
    virtual TRESULT GetCBConsultant(pfnCBClient *ppfn, void **ppUserdata);
    virtual TRESULT SetCBGuide(pfnCBClient pfn, void *pUserdata);
    virtual TRESULT GetCBGuide(pfnCBClient *ppfn, void **ppUserdata);
    virtual TRESULT SetCBPropagandist(pfnCBClient pfn, void *pUserdata);
    virtual TRESULT GetCBPropagandist(pfnCBClient *ppfn, void **ppUserdata);
private:
    TRESULT InitConfig();
    void UnInitConfig();
    TRESULT InitCommon();
    void UnInitCommon();
    QLibrary*   m_pLibConfig;
    QLibrary*   m_pLibCommon;
private:
    QString     m_szLog;
    ITLogger    *m_pLogger;
    ITCommon    *m_pCommon;
    ITConfig    *m_pConfig;
    ITPublicMgr *m_pPublicMgr;
    ITUiMgr     *m_pUiMgr;
    ITService   *m_pSalesman;
    ITService   *m_pSaleswoman;
    ITService   *m_pUiService;
    //
    pfnCBClient m_pfnCBStart;
    void        *m_pUserdataStart;
    pfnCBClient m_pfnCBCheckIn;
    void        *m_pUserdataCheckIn;
    pfnCBClient m_pfnCBConsultant;
    void        *m_pUserdataConsultant;
    pfnCBClient m_pfnCBGuide;
    void        *m_pUserdataGuide;
    pfnCBClient m_pfnCBPropagandist;
    void        *m_pUserdataPropagandist;
};

#endif // TFRAMEWORK_H
